package com.yolib.sanyi.tool;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;


public class Utility {

	private final static String SANYI_API_HOST ="http://50.6.110.94/xmlapi/getXML.php";
	private final static String SANYI_TEST_API_HOST ="http://50.6.110.94/xmlapi/";
	private final static String SANYI_HOST ="http://50.6.110.94/";
	private final static String SANYI_IMG_HOST ="http://50.6.110.94/";
	
	
	static final long MIN = 60;
	static final long HOUR = 60*60;
	static final long DAY = 24*60*60;
	
	
	
	public static String getAPIHost()
	{
		return SANYI_API_HOST;
	}
	
	public static String getAPIURL() {
		return SANYI_HOST;
	}
	
	public static String getIMGAPIURL() {
		return SANYI_IMG_HOST;
	}
	public static String getTESTAPIURL() {
		return SANYI_TEST_API_HOST;
	}

	
	public static boolean detectNetWorkfunction(Context context){
		ConnectivityManager net = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo info = net.getActiveNetworkInfo();
		if (info == null || !info.isConnected()){
			return false;
		}
		return true;
	}
	
	
}
